package org.fengkuok.richworkdesigner.model.node.connection
{
	import org.fengkuok.richworkdesigner.component.BaseNodeComponent;
	import org.fengkuok.richworkdesigner.model.node.Node;

	/**
	 * Sequence Flow Node
	 * @company ZSword (C) Copyright
	 * @author JemiZhuu(周士淳)
	 * @category SequenceFlowNode
	 * @version 1.0
	 * @since 2011-09-01
	 *
	 */
	public class SequenceFlowNode extends Node {
		
		public function SequenceFlowNode(fromNode:Node, toNode:Node) {
			super();
			this.fromNode = fromNode;
			this.toNode = toNode;
		}
		
		override protected function initDatas():void {
			super.initDatas();
			this.category = CAT_CONNECTION;
		}
		
		private var _fromNode:Node;
		private var _toNode:Node;
		
		public function set fromNode(node:Node):void {
			this._fromNode = node;
			notifyFromNodeChanged();
		}
		
		public function get fromNode():Node {
			return this._fromNode;			
		}
		
		public function set toNode(node:Node):void {
			this._toNode = node;
			notifyToNodeChanged();
		}
		
		public function get toNode():Node {
			return this._toNode;
		}
		
		/**
		 * 通知From节点被修改 
		 * 
		 */
		private function notifyFromNodeChanged():void {
			var targetComponent:BaseNodeComponent = fromNode.getComponent();
			var px:Number = targetComponent.x;
			var py:Number = targetComponent.y;
		}
		
		/**
		 * 通知To节点被修改 
		 * 
		 */
		private function notifyToNodeChanged():void {
			var targetComponent:BaseNodeComponent = toNode.getComponent();
			var px:Number = targetComponent.x;
			var py:Number = targetComponent.y;
		}		
	}
}